{include file="public/header" /}
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/webuploader.css">
<link rel="stylesheet" type="text/css" href="/static/admin/webupload/style.css">
<style type="text/css">
/* TAB */
.nav-tabs.nav>li>a {
    padding: 10px 25px;
    margin-right: 0;
}
.nav-tabs.nav>li>a:hover,
.nav-tabs.nav>li.active>a {
    border-top: 3px solid #1ab394;
    padding-top: 8px;
    border-bottom: 1px solid #FFFFFF;
}
.nav-tabs>li>a {
    color: #A7B1C2;
    font-weight: 500;  
    margin-right: 2px;
    line-height: 1.42857143;
    border: 1px solid transparent;
    border-radius: 0;
}
</style>

<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>网站配置</h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="form_basic.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">       
                    <div class="panel blank-panel">
                        <div class="panel-heading">                     
                            <div class="panel-options">
                                <ul class="nav nav-tabs">
                                    <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">基本配置</a></li>
<!--                                    <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">内容配置</a></li>-->
                                    <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">系统配置</a></li>
<!--                                    <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">短信配置</a></li>-->
<!--                                    <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">小票机配置</a></li>-->
<!--                                    <li class=""><a data-toggle="tab" href="#tab-6" aria-expanded="false">达达配置</a></li>-->
<!--                                    <li class=""><a data-toggle="tab" href="#tab-7" aria-expanded="false">商品评分配置</a></li>-->
                                </ul>
                            </div>
                        </div>
                        <div class="panel-body">
                            <div class="tab-content">
                                <div id="tab-1" class="tab-pane active">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">  
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">小程序标题：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[wechat_title]" value="{$config.wechat_title}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 小程序标题</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">小程序分享描述：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[share_desc]" value="{$config.share_desc}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 小程序分享描述</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">小程序分享图片：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="hidden" id="data_photo" name="config[share_pic]" value="{$config.share_pic}">
                                                <div id="fileList" class="uploader-list" style="float:right"></div>
                                                <div id="imgPicker" style="float:left">选择文件</div>
                                                <img id="img_data" class="img-circle" height="80px" width="80px" style="float:left;margin-left: 50px;margin-top: -10px;" {if condition="$config.share_pic"} src="{$config.share_pic} "   {else/}  src="/static/admin/images/head_default.gif" {/if} />
                                            </div>
                                        </div>

                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">网站标题：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[web_site_title]" value="{$config.web_site_title}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 网站标题</span>                                           
                                            </div>
                                        </div>                                 
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">域名：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[web_url]" value="{$config.web_url}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 域名</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">网站描述：</label>
                                            <div class="input-group col-sm-4">
                                                <textarea class="form-control" type="text" rows="3" name="config[web_site_description]">{$config.web_site_description}</textarea>
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 网站搜索引擎描述</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">网站关键字：</label>
                                            <div class="input-group col-sm-4">
                                                <textarea class="form-control" type="text" rows="3" name="config[web_site_keyword]">{$config.web_site_keyword}</textarea>
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 网站搜索引擎关键字</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">网站备案号：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[web_site_icp]" value="{$config.web_site_icp}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 设置在网站底部显示的备案号</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">统计代码：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <textarea class="form-control" type="text" rows="3" name="config[web_site_cnzz]">{$config.web_site_cnzz}</textarea>
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 设置在网站底部显示的站长统计信息</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">版权信息：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[web_site_copy]" value="{$config.web_site_copy}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 设置在网站底部显示的版权信息</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>                               
                                    </form>
                                </div>
                                <div id="tab-2" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">纽澳评星描述(仅输入文字)：</label>
                                            <div class="input-group col-sm-4">
                                                <script src="/static/admin/ueditor/ueditor.config.js" type="text/javascript"></script>
                                                <script src="/static/admin/ueditor/ueditor.all.js" type="text/javascript"></script>
                                                <textarea name="config[point_desc]" style="width:90%" id="myEditor">{$config.point_desc}</textarea>
                                                <script type="text/javascript">
                                                    var editor = new UE.ui.Editor();
                                                    editor.render("myEditor");
                                                </script>
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 纽澳评星描述</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>                                
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">后台每页记录数：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[list_rows]" value="{$config.list_rows}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 后台数据每页显示记录数</span>                                           
                                            </div>
                                        </div>                                 
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">用户券提醒天数：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[coupon_notice_day]" value="{$config.coupon_notice_day}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 用户券使用提醒天数</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">同城配送最大距离(km)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[express_distance]" value="{$config.express_distance}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 同城配送最大距离</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">物流费用(元)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[express_fee]" value="{$config.express_fee}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 物流费用</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">预计物流配送时间(天)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[express_day]" value="{$config.express_day}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 预计物流配送时间(天)</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>                               
                                    </form>
                                </div>
                                <div id="tab-3" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">                             
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">禁止后台访问IP：</label>
                                            <div class="input-group col-sm-4">
                                                <textarea class="form-control" type="text" rows="3" name="config[admin_allow_ip]">{$config.admin_allow_ip}</textarea>
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 多个用#号分隔，如果不配置表示不限制IP访问</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>                               
                                    </form>
                                </div>
                                <div id="tab-4" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">  
                                        <div class="hr-line-dashed"></div>                                
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">AppKey：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[alisms_appkey]" value="{$config.alisms_appkey}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请前往阿里云云通信平台查看AppKey</span>                                           
                                            </div>
                                        </div>                                 
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">AppSecret：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[alisms_appsecret]" value="{$config.alisms_appsecret}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请前往阿里云云通信平台查看AppSecret</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">短信签名：</label>
                                            <div class="input-group col-sm-4">                                              
                                                <input type="text" class="form-control" name="config[alisms_signname]" value="{$config.alisms_signname}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请前往阿里云云通信平台查看短信签名</span>                                           
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>                               
                                    </form>
                                </div>

                                <div id="tab-5" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">飞鹅云后台注册用户名：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[print_user]" value="{$config.print_user}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 飞鹅云后台注册用户名</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">UKEY：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[print_key]" value="{$config.print_key}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 飞鹅云后台 UKEY</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>
                                    </form>
                                </div>


                                <div id="tab-6" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">达达商户编号：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[source_id]" value="{$config.source_id}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 达达商户编号</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">app_key：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[dd_app_key]" value="{$config.dd_app_key}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 达达app_key</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">app_secret：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[dd_app_secret]" value="{$config.dd_app_secret}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 达达app_secret</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>
                                    </form>
                                </div>


                                <div id="tab-7" class="tab-pane">
                                    <form action="{:url('save')}" method="post" class="form-horizontal">
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">单个苹果热量：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[kl_apple]" value="{$config.kl_apple}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 单个苹果热量</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">单碗米饭热量：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[kl_rice]" value="{$config.kl_rice}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 单碗米饭热量</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">单米数热量：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[kl_mile]" value="{$config.kl_mile}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 单米数热量</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">热量参考值(PerServe)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_heat]" value="{$config.goods_heat}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 热量参考值(kcal)</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">脂肪参考值(Per100)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_fat]" value="{$config.goods_fat}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 脂肪参考值(g)</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">饱和脂肪酸参考值(Per100)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_all_fat]" value="{$config.goods_all_fat}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 饱和脂肪酸参考值(g)</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">糖分参考值(Per100)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_sugar]" value="{$config.goods_sugar}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 糖分参考值(g)</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">纤维参考值(PerServe)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_fibre]" value="{$config.goods_fibre}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 纤维参考值(g)</span>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">盐度参考值(Per100)：</label>
                                            <div class="input-group col-sm-4">
                                                <input type="text" class="form-control" name="config[goods_salt]" value="{$config.goods_salt}">
                                                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 盐度参考值(mg)</span>
                                            </div>
                                        </div>
                                        <div class="hr-line-dashed"></div>
                                        <div class="form-group">
                                            <div class="col-sm-4 col-sm-offset-3">
                                                <button class="btn btn-primary" type="submit"><i class="fa fa-save"></i> 保存信息</button>&nbsp;&nbsp;&nbsp;
                                                <a class="btn btn-danger" href="javascript:history.go(-1);"><i class="fa fa-close"></i> 返回</a>
                                            </div>
                                        </div>
                                    </form>
                                </div>



                            </div>
                        </div>
                    </div>         
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript" src="/static/admin/webupload/webuploader.min.js"></script>
<script type="text/javascript">

    var $list = $('#fileList');
    //上传图片,初始化WebUploader
    var uploader = WebUploader.create({

        auto: true,// 选完文件后，是否自动上传。
        swf: '/static/admin/webupload/Uploader.swf',// swf文件路径
        server: "{:url('Upload/upload')}",// 文件接收服务端。
        duplicate :true,// 重复上传图片，true为可重复false为不可重复
        pick: '#imgPicker',// 选择文件的按钮。可选。
        multiple: false, //是否多文件
        fileSingleSizeLimit: 1024*1024, //文件大小 单位默认  b
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/jpg,image/jpeg,image/png'
        },

        'onUploadSuccess': function(file, data, response) {
            $("#data_photo").val('/uploads/images/'+data._raw);
            $("#img_data").attr('src', '/uploads/images/' + data._raw).show();
        }
    });


    //当validate不通过时，会以派送错误事件的形式通知
    uploader.on('error', function (type) {
        switch (type) {
            case 'Q_EXCEED_NUM_LIMIT':
                layer.msg('错误：上传文件数量过多！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'Q_EXCEED_SIZE_LIMIT':
                layer.msg('错误：文件总大小超出限制！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'F_EXCEED_SIZE':
                layer.msg('错误：文件大小超出限制！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'Q_TYPE_DENIED':
                layer.msg('错误：禁止上传该类型文件！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'F_DUPLICATE':
                layer.msg('错误：请勿重复上传该文件！', {icon: 5,time:1500,shade: 0.1});
                break;
            default:
                layer.msg('错误代码：' + type, {icon: 5,time:1500,shade: 0.1});
                break;
        }
    });

    uploader.on( 'fileQueued', function( file ) {
        $list.html( '<div id="' + file.id + '" class="item">' +
            '<h4 class="info">' + file.name + '</h4>' +
            '<p class="state">正在上传...</p>' +
            '</div>' );
    });



    // 文件上传过程中创建进度条实时显示。
    uploader.on( 'uploadProgress', function( file, percentage ) {
        var $li = $( '#'+file.id ),
            $percent = $li.find('.progress span');

        // 避免重复创建
        if ( !$percent.length ) {
            $percent = $('<p class="progress"><span></span></p>')
                .appendTo( $li )
                .find('span');
        }

        $percent.css( 'width', percentage * 100 + '%' );
    });


    // 文件上传成功
    uploader.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    });

    // 完成上传完了，成功或者失败，先删除进度条。
    uploader.on( 'uploadComplete', function( file ) {
        $( '#'+file.id ).find('.progress').remove();
    });


    var $list1 = $('#fileList1');
    //上传图片,初始化WebUploader
    var uploader1 = WebUploader.create({

        auto: true,// 选完文件后，是否自动上传。
        swf: '/static/admin/webupload/Uploader.swf',// swf文件路径
        server: "{:url('Upload/upload')}",// 文件接收服务端。
        duplicate :true,// 重复上传图片，true为可重复false为不可重复
        pick: '#imgPicker1',// 选择文件的按钮。可选。
        multiple: false, //是否多文件
        fileSingleSizeLimit: 1024*1024, //文件大小 单位默认  b
        accept: {
            title: 'Images',
            extensions: 'gif,jpg,jpeg,bmp,png',
            mimeTypes: 'image/jpg,image/jpeg,image/png'
        },

        'onUploadSuccess': function(file, data, response) {
            $("#data_photo1").val('/uploads/images/'+data._raw);
            $("#img_data1").attr('src', '/uploads/images/' + data._raw).show();
        }
    });


    //当validate不通过时，会以派送错误事件的形式通知
    uploader1.on('error', function (type) {
        switch (type) {
            case 'Q_EXCEED_NUM_LIMIT':
                layer.msg('错误：上传文件数量过多！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'Q_EXCEED_SIZE_LIMIT':
                layer.msg('错误：文件总大小超出限制！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'F_EXCEED_SIZE':
                layer.msg('错误：文件大小超出限制！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'Q_TYPE_DENIED':
                layer.msg('错误：禁止上传该类型文件！', {icon: 5,time:1500,shade: 0.1});
                break;
            case 'F_DUPLICATE':
                layer.msg('错误：请勿重复上传该文件！', {icon: 5,time:1500,shade: 0.1});
                break;
            default:
                layer.msg('错误代码：' + type, {icon: 5,time:1500,shade: 0.1});
                break;
        }
    });

    uploader1.on( 'fileQueued', function( file ) {
        $list1.html( '<div id="' + file.id + '" class="item">' +
            '<h4 class="info">' + file.name + '</h4>' +
            '<p class="state">正在上传...</p>' +
            '</div>' );
    });



    // 文件上传过程中创建进度条实时显示。
    uploader1.on( 'uploadProgress', function( file, percentage ) {
        var $li = $( '#'+file.id ),
            $percent = $li.find('.progress span');

        // 避免重复创建
        if ( !$percent.length ) {
            $percent = $('<p class="progress"><span></span></p>')
                .appendTo( $li )
                .find('span');
        }

        $percent.css( 'width', percentage * 100 + '%' );
    });


    // 文件上传成功
    uploader1.on( 'uploadSuccess', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传成功！');
    });

    // 文件上传失败，显示上传出错。
    uploader1.on( 'uploadError', function( file ) {
        $( '#'+file.id ).find('p.state').text('上传出错!');
    });

    // 完成上传完了，成功或者失败，先删除进度条。
    uploader1.on( 'uploadComplete', function( file ) {
        $( '#'+file.id ).find('.progress').remove();
    });




    var config = {
        '.chosen-select': {},                    
    }
    for (var selector in config) {
        $(selector).chosen(config[selector]);
    }
</script>
</body>
</html>
